cmake_minimum_required(VERSION 3.4.1)
add_definitions(-std=c++11)


include_directories(src/main/cpp/include)
include_directories(src/main/cpp/soundTouch/include)
include_directories(src/main/cpp/soundTouch/SoundTouch)

find_library(
              log-lib
              log )
 find_library( # Sets the name of the path variable.
                            opensl

                            # Specifies the name of the NDK library that
                            # you want CMake to locate.
                            OpenSLES)



set(distribution_DIR ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI})

add_library( avutil
             SHARED
             IMPORTED )

set_target_properties( avutil
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/libavutil-55.so )

add_library( swresample
             SHARED
             IMPORTED )

set_target_properties( swresample
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/libswresample-2.so)

add_library( avcodec
             SHARED
             IMPORTED )

set_target_properties( avcodec
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/libavcodec-57.so)

add_library( avformat
             SHARED
             IMPORTED )

set_target_properties( avformat
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/libavformat-57.so)

add_library( swscale
             SHARED
             IMPORTED )

set_target_properties( swscale
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/libswscale-4.so)

add_library( postproc
             SHARED
             IMPORTED )

set_target_properties( postproc
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/libpostproc-54.so)

add_library( avfilter
             SHARED
             IMPORTED )

set_target_properties( avfilter
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/libavfilter-6.so)

add_library( avdevice
             SHARED
             IMPORTED )

set_target_properties( avdevice
                       PROPERTIES IMPORTED_LOCATION
                       ${distribution_DIR}/libavdevice-57.so)


add_library(
             native-lib
             SHARED

             src/main/cpp/native-lib.cpp
             src/main/cpp/WIAudio.cpp
             src/main/cpp/WIPlayer.cpp
             src/main/cpp/javaCallBack.cpp
             src/main/cpp/WIQueue.cpp
             src/main/cpp/WIPlayState.cpp
             src/main/cpp/WIVideo.cpp
             )

add_library(
             soundTouch-lib
             SHARED
             src/main/cpp/soundtouch/SoundTouch/AAFilter.cpp
             src/main/cpp/soundtouch/SoundTouch/FIFOSampleBuffer.cpp
             src/main/cpp/soundtouch/SoundTouch/FIRFilter.cpp
             src/main/cpp/soundtouch/SoundTouch/cpu_detect_x86.cpp
             src/main/cpp/soundtouch/SoundTouch/sse_optimized.cpp
             src/main/cpp/soundtouch/SoundTouch/RateTransposer.cpp
             src/main/cpp/soundtouch/SoundTouch/SoundTouch.cpp
             src/main/cpp/soundtouch/SoundTouch/InterpolateCubic.cpp
             src/main/cpp/soundtouch/SoundTouch/InterpolateLinear.cpp
             src/main/cpp/soundtouch/SoundTouch/InterpolateShannon.cpp
             src/main/cpp/soundtouch/SoundTouch/TDStretch.cpp
             src/main/cpp/soundtouch/SoundTouch/PeakFinder.cpp
             )






target_link_libraries(# Specifies the target library.
                       native-lib
                       soundTouch-lib
                       avutil
                       swresample
                       avcodec
                       avformat
                       swscale
                       postproc
                       avfilter
                       avdevice
                       ${log-lib}
                       ${opensl}
                       )